package com.ruoyi.flowable.entity;

import org.flowable.bpmn.model.SequenceFlow;
import org.flowable.bpmn.model.UserTask;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

//提交处理单实体类
public class SubmitFormEntity {

    //用户意见
    private String ideaContent;

    private Map<String, List<TaskForUser>> dynamicUserTaskList = new HashMap<String, List<TaskForUser>>();

    public SubmitFormEntity() {

    }

    public SubmitFormEntity(Map<String, List<TaskForUser>> dynamicUserTaskList) {
        this.dynamicUserTaskList = dynamicUserTaskList;
    }

    public void add(String sequenceFlowName, TaskForUser taskForUser) {
        if (this.dynamicUserTaskList.containsKey(sequenceFlowName)) {
            if (dynamicUserTaskList.get(sequenceFlowName)!=null)
                dynamicUserTaskList.get(sequenceFlowName).add(taskForUser);
            else{
                List<TaskForUser> t = new ArrayList();
                t.add(taskForUser);
                dynamicUserTaskList.put(sequenceFlowName, t);
            }
        } else {
            List<TaskForUser> t = new ArrayList();
            t.add(taskForUser);
            dynamicUserTaskList.put(sequenceFlowName, t);
        }
    }

    public String getIdeaContent() {
        return ideaContent;
    }

    public void setIdeaContent(String ideaContent) {
        this.ideaContent = ideaContent;
    }

    public Map<String, List<TaskForUser>> getDynamicUserTaskList() {
        return dynamicUserTaskList;
    }

    public void setDynamicUserTaskList(Map<String, List<TaskForUser>> dynamicUserTaskList) {
        this.dynamicUserTaskList = dynamicUserTaskList;
    }

    @Override
    public String toString() {
        return "SubmitFormEntity{" +
                "ideaContent='" + ideaContent + '\'' +
                ", dynamicUserTaskList=" + dynamicUserTaskList +
                '}';
    }
}
